/**  
 * Copyright © 2014公司名字. All rights reserved.
 *
 * @Title: MpUserServiceImpl.java
 * @Prject: manpower
 * @Package: com.manpower.service.impl
 * @Description: TODO
 * @author: Administrator  
 * @date: 2014年8月19日 上午10:06:20
 * @version: V1.0  
 */
package com.manpower.service.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.manpower.dao.BaseDaoI;
import com.manpower.model.MpUser;
import com.manpower.pageModel.User;
import com.manpower.service.MpUserService;
import com.manpower.util.MD5Util;

/**
 * @ClassName: MpUserServiceImpl
 * @Description: TODO
 * @author: Administrator
 * @date: 2014年8月19日 上午10:06:20
 */
@Service("mpUserService")
public class MpUserServiceImpl implements MpUserService {

	/**
	 * UserDao对用户类进行操作
	 */
	private BaseDaoI<MpUser> mpUserDao;
	
	/**
	 * @Title: save
	 * @Description: TODO
	 * @param u
	 * @return
	 * @see com.manpower.service.MpUserService#save(com.manpower.model.MpUser)
	 */
	@Override
	public Serializable save(MpUser u) {
		u.setId(UUID.randomUUID().toString());
		u.setUserName("admin");
		u.setUserPwd(MD5Util.md5("admin"));
		return mpUserDao.save(u);
	}
	
	@Override
	public Serializable login(User u) {
		Map<String, Object> params=new HashMap<String, Object>();
		MpUser user=mpUserDao.get("from MpUser u where u.mpUserName=:name and u.mpUserPwd=:pwd",params);
		return user;
	}

	//------------------get set ---------------------
	public BaseDaoI<MpUser> getMpUserDao() {
		return mpUserDao;
	}
	@Autowired
	public void setMpUserDao(BaseDaoI<MpUser> mpUserDao) {
		this.mpUserDao = mpUserDao;
	}
	
	
	
	
	

}
